package cn.openea.perpartner.link.web.controller;

import cn.openea.perpartner.common.core.web.domain.AjaxResult;
import cn.openea.perpartner.link.constant.enums.AppType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ysk
 * @version 1.0.1
 * @Description TODO
 * @createTime 2023年05月22日 11:33:00
 */
@RestController
@RequestMapping("/app/type")
public class AppTypeController {


    @GetMapping("/all")
    public AjaxResult allList(){
        List<Map<String, String>> collect = Arrays.stream(AppType.values()).map(item -> {
            Map<String, String> map = new HashMap<>();
            map.put(item.getCode(), item.getName());
            return map;
        }).collect(Collectors.toList());
        return AjaxResult.success(collect);
    }
}
